import Vue from 'vue'
import VueResource from 'vue-resource'
import ElementUI from 'element-ui'
import 'element-ui/lib/theme-default/index.css' //elementUI默认
/*import './assets/css/theme-gray/index.css'
import './assets/css/theme-red/index.css'
import './assets/css/theme-default/index.css'
import './assets/css/theme-blue/index.css'*/

// import '../theme/index.css'

// import exportExcel from './assets/js/exportExcel/exportExcel.js'//导出excel表格
import exportExcel from './assets/js/exportExcel/Export2Excel.js'//导出excel表格
import getErrorMsg from './assets/js/errcode.js' //错误码
import router from './router/index.js'
import store from './store/index.js' //vuex 使用
import App from './App.vue'

// Vue.use(exportExcel);
Vue.use(exportExcel);
Vue.use(ElementUI);
Vue.use(VueResource);
Vue.use(getErrorMsg);

const whiteList = ['/login'];// 不重定向白名单
router.beforeEach((to, from, next) => {
  if (localStorage.getItem("ZULONGBIISLOGING") === "true") { // 判断是否有token
      next();
  } else {
    if (whiteList.indexOf(to.path) !== -1) { // 在免登录白名单，直接进入
      next()
    } else {
      next('/login'); // 否则全部重定向到登录页
    }
  }
});
new Vue({
  router,
  store,
  el: '#app',
  render: function (h) {
  	return h(App)
  }
})